<?php
/*
 *  this is a script for training the crawled date into the index
 *
 */
include_once "to_index.php";
include_once "sql.php";

sqlInit();
while(true){
 $i = sqlQuery("SELECT * FROM kp_indexed_images WHERE `trained`=0", array("image_link","id"));
 foreach($i as $v){
  echo $v["image_link"] . "\n";
  url_to_index( $v["image_link"], $v["id"] );
  sqlQuery("UPDATE kp_indexed_images SET `trained`=1 WHERE `id`=".$v["id"]);
 }
 sleep(60);
}
sqlClose();

?>
